#ifndef _SIMPLE_QUEUE_H__
#define _SIMPLE_QUEUE_H__
 
#define MQ_NAME 						"test"
#define MQ_FLAG_BLOCK 					QUEUE_BLOCK
#define MQ_FLAG_NO_BLOCK 				QUEUE_NO_BLOCK
#define MQ_LENGTH_MAX 					10
#define MQ_SIZE_MAX 					512
 

#include<pthread.h>
 
typedef struct _simple_queue
{
	int front;
	int rear;
	int length;
	pthread_mutex_t data_mutex;
	void *data[0];
}simple_queue;
 
typedef struct _simple_queue_buf
{
	int msg_type;
	int msg_prio;
	char msg_buf[50];
	//char* msg_buf;
}queue_buf;
 
typedef enum _queue_status
{
	QUEUE_IS_NORMAL = 0,
	QUEUE_NO_EXIST,
	QUEUE_IS_FULL,
	QUEUE_IS_EMPTY,
	
}queue_status;
 
typedef enum _cntl_queue_ret
{
	CNTL_QUEUE_SUCCESS = 0,
	CNTL_QUEUE_FAIL,
	CNTL_QUEUE_TIMEOUT,
	CNTL_QUEUE_PARAM_ERROR,
}cntl_queue_ret;
 
simple_queue* create_simple_queue(int queue_length);
queue_status is_full_queue(simple_queue* p_queue);
queue_status is_empty_queue(simple_queue* p_queue);
cntl_queue_ret push_simple_queue(simple_queue* p_queue, void* data);
cntl_queue_ret pop_simple_queue(simple_queue* p_queue, void** data);
cntl_queue_ret destroy_simple_queue(simple_queue* p_queue);
 
 
#endif